package com.wc.fortnight_blue_bridge.Q231019.宝玉与黛玉的考验;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/10/20 0:18
 * @description https://www.lanqiao.cn/problems/19928/learning/?contest_id=212
 */
public class Main {
    /**
     * 思路：假设 k 里面 有s 中有 a1 个 1, a0 个 0, t里面有 b1 个 1, b0 个 0<p>
     * x = a0 * b1 + a1 * b0, a0 + a1 = b0 + b1 = k<p>
     * 假设 b1 已知, x = a1 * (k - 2 * b1) + b1 * k
     * 如果 2 * b1 < k, a1要最大, 反之
     */
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 200010;
    static int[] s1 = new int[N], s2 = new int[N];
    static int n, m, k;

    public static void main(String[] args) {
        n = sc.nextInt();
        m = sc.nextInt();
        k = sc.nextInt();
        char[] cs = (" " + sc.next()).toCharArray();
        for (int i = 1; i <= n; i++) {
            if (cs[i] == '1') s1[i] = 1;
            s1[i] += s1[i - 1];
        }
        cs = (" " + sc.next()).toCharArray();
        for (int i = 1; i <= m; i++) {
            if (cs[i] == '1') s2[i] = 1;
            s2[i] += s2[i - 1];
        }
        long max11 = 0, max10 = 0;
        for (int i = k; i <= n; i++) {
            max11 = Math.max(max11, s1[i] - s1[i - k]);
            max10 = Math.max(max10, k - (s1[i] - s1[i - k]));
        }
        HashSet<Long> set = new HashSet<>();
        for (int i = k; i <= m; i++) {
            set.add((long) s2[i] - s2[i - k]);
        }
        long res = 0;
        for (long b1 : set) {
            if (b1 * 2 < k) res = Math.max(res, max11 * (k - 2 * b1) + b1 * k);
            else res = Math.max(res, (k - max10) * (k - 2 * b1) + b1 * k);
        }
        out.println(res);
        out.flush();
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}
